import request from '../utils/request'

/**
 * 超管-医院管理接口（宠物医院/诊所信息管理）
 */
export const hospitalApi = {
  // 获取医院列表（支持分页、搜索、地区筛选）
  getHospitalList: (params) => request({
    url: '/hospital/list',
    method: 'get',
    params // params: { pageNum, pageSize, keyword, region, status }
  }),

  // 获取医院详情
  getHospitalDetail: (id) => request({
    url: `/hospital/detail/${id}`,
    method: 'get'
  }),

  // 添加医院
  addHospital: (params) => request({
    url: '/hospital/add',
    method: 'post',
    data: params // data: { name, address, region, contactPerson, phone, level, bedCount, status, remark }
  }),

  // 编辑医院
  editHospital: (params) => request({
    url: '/hospital/edit',
    method: 'post',
    data: params // 含 id + 其他医院信息
  }),

  // 更改医院状态（启用/禁用）
  updateHospitalStatus: (params) => request({
    url: '/hospital/status',
    method: 'post',
    data: params // data: { id, status: 1/0 }
  }),

  // 获取医院等级列表（如：一级/二级/三级宠物医院）
  getHospitalLevel: () => request({
    url: '/hospital/level',
    method: 'get'
  }),

  // 给医院分配医生（关联医生与医院）
  assignDoctorToHospital: (params) => request({
    url: '/hospital/assign-doctor',
    method: 'post',
    data: params // data: { hospitalId, doctorIds: [1,2,3] }
  }),

  // 获取医院关联的医生列表
  getHospitalDoctors: (hospitalId) => request({
    url: `/hospital/doctors/${hospitalId}`,
    method: 'get'
  })
}

// 导出快捷调用
export const {
  getHospitalList,
  getHospitalDetail,
  addHospital,
  editHospital,
  updateHospitalStatus,
  getHospitalLevel,
  assignDoctorToHospital,
  getHospitalDoctors
} = hospitalApi